<?php
namespace app\index\controller;
use think\Controller;
use location;
class Register extends Controller
{
	//注册用户
	public function index(){
	   return $this->fetch();
    }

    //添加注册用户
    public function add(){
    	if(request() -> isPost()){
			$data = model('Register')->index();
			if($data == 1){
				$this->success("注册成功",'index/login/index','',1);
			}elseif($data == 602){
				$this->error('用户名存在,请重新输入','index/register/index','',1);
				exit;
			}elseif($data == 4){
				$this->error('注册失败,你还未同意协议','index/register/index','',1);
				exit;
			}elseif($data == 604){
	            $this->error('注册失败,邀请码不存在','index/register/index','',1);
				exit;
			}else{
				$this->error('addusers','index/register/index','',1);
				exit;
			}	
		}else{
			$this->error('请求失败');
				exit;
		}
    }

}